<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>类型</title>
</head>
<body>

</body>
<script>

    var d= new Date();

    /*构造器模式*/
    function Employee(name) {
        this.name = name;
        this.sayHello=function () {
            alert("hello:"+this.name);
        }
    }

    var emp1 = new Employee('Martin');
 //   emp1.age = 23;
  //  alert(emp1.name);
 //   alert(emp1.age);
    emp1.sayHello();

    var emp2 = new Employee('Lee');
  //  alert(emp2.name);
    emp2.sayHello();

</script>
</html>